﻿@model SimpComm.SelectBoxModel
@{
    if (Model.DataBind.Count != 0)
    {
    <div class="bfh-selectbox">
        <input type="hidden" name="@Model.ControlID" value="@(Model.DefaultValue != null ? Model.DefaultValue.Value : "")" id="@Model.ControlID">
        <a class="bfh-selectbox-toggle" role="button" data-toggle="bfh-selectbox" href="#">
            @{
        var defvalue = Model.DefaultValue;
            }
            @if (Model.DefaultValue == null)
            {
                <span class="bfh-selectbox-option input-medium" data-option="@Model.DataBind[0].Value">@Model.DataBind[0].Text</span>
                defvalue = @Model.DataBind[0];
            }
            else
            {
                foreach (var item in Model.DataBind)
                {

                    if (item.Value == Model.DefaultValue.Value)
                    {
                <span class="bfh-selectbox-option input-medium" data-option="@item.Value">@item.Text</span>
                        defvalue = @item;
                    }
                }
            }
            <b class="caret"></b>
        </a>
        <div class="bfh-selectbox-options">
            @if (Model.IsInputBox)
            {
                <input type="text" class="bfh-selectbox-filter" />
            }
            <div role="listbox">
                <ul role="option">
                    @foreach (var item in Model.DataBind)
                    {
                        if (item.Value != defvalue.Value)
                        {
                        <li><a tabindex="-1" href="#" data-option="@item.Value">@item.Text</a></li>
                        }
                    }
                </ul>
            </div>
        </div>
    </div>
    }
}
